package com.hsteach.web.controller.equipment;

import com.hsteach.common.core.controller.BaseController;
import com.hsteach.common.core.domain.AjaxResult;
import com.hsteach.common.core.page.TableDataInfo;
import com.hsteach.dao.domain.equipment.EquipmentRepair;
import com.hsteach.service.equipment.EquipmentRepairResultService;
import com.hsteach.web.controller.equipment.dto.EquipmentPublicDto;
import com.hsteach.web.controller.equipment.dto.EquipmentRepairResultDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(value = "设备维修信息", tags = "设备维修信息")
@RestController
@RequestMapping("/equipment/repairResult")
public class EquipmentRepairResultController extends BaseController {

    @Autowired
    private EquipmentRepairResultService equipmentRepairResultService;

    /**
     *维修职工查询设备维修列表
     * @return
     */
    @ApiOperation("维修职工查询设备维修列表")
    @PostMapping("list")
    public TableDataInfo<EquipmentRepair> list(@RequestBody EquipmentPublicDto equipmentPublicDto){
       List<EquipmentRepair> list = equipmentRepairResultService.qureyList(equipmentPublicDto);
       return getDataTable(list);
    }

    /**
     * 新增维修信息
     * @param equipmentRepairResultDto
     * @return
     */
    @ApiOperation("新增维修信息")
    @PostMapping("/add")
    public AjaxResult add(@RequestBody EquipmentRepairResultDto equipmentRepairResultDto){
        return success(equipmentRepairResultService.add(equipmentRepairResultDto));
    }

}
